January 09, 2015
GetAreas JSON Service
This function will provide a JSON formatted list of areas where numbers are available for purchase
Meta:
GetAreas(Username, Password, CountryCode)
Sample usage:
POST:
curl -X POST http://api.multitel.net/json/getareas \
--data-urlencode "UserName=USERNAME" \
--data-urlencode "Password=PASSWORD" \
--data-urlencode "CountryCode=US" \
GET:
curl -X GET http://api.multitel.net/json/getareas/USERNAME/PASSWORD/US
Please note that for both POST and GET you can also obtain the XML formatted output by using the following base link:
http://api.multitel.net/xml/getareas/
Or, for PHP-Curl/HTML example, see below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$server_url = 'http://api.multitel.net/json/getareas/ | |
// or for GET : http://api.multitel.net/json/getareas/UserName/Password/CountryCode | |
if(isset($_POST['submit'])) { | |
$data = array( | |
'UserName' => $_POST['username'], | |
'Password' => $_POST['password'], | |
'CountryCode' => $_POST['country_code'], | |
); | |
$handle = curl_init($server_url); | |
curl_setopt($handle, CURLOPT_POST, true); | |
curl_setopt($handle, CURLOPT_POSTFIELDS, $data); | |
curl_exec($handle); | |
} | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>GetAreas JSON</title> | |
</head> | |
<body> | |
<form name="form1" method="post" action=""> | |
Username : <input type="text" name="username" value="administrator" /> | |
<br /> | |
Password : <input type="text" name="password" value="password" /> | |
<br /> | |
Country Code : <input type="text" name="country_code" value="CA" /> | |
<br /> | |
<input type="submit" name="submit" value="submit" /> | |
</form> | |
</body> | |
</html> |
Result will be:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"DATA": | |
[ | |
{ | |
"AREACODE":"1201", | |
"DESCRIPTION":"Jersey City", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"40.7281575", | |
"ALONGITUDE":"-74.0776417" | |
},{ | |
"AREACODE":"1202", | |
"DESCRIPTION":"Washington", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"38.8951118", | |
"ALONGITUDE":"-77.0363658" | |
},{ | |
"AREACODE":"1203", | |
"DESCRIPTION":"Bridgeport", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"41.0771914", | |
"ALONGITUDE":"-73.4686858" | |
},{ | |
"AREACODE":"1205", | |
"DESCRIPTION":"Central Alabama", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"33.5206608", | |
"ALONGITUDE":"-86.8024900" | |
},{ | |
"AREACODE":"1206", | |
"DESCRIPTION":"Seattle", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"47.6062095", | |
"ALONGITUDE":"-122.3320708" | |
},{ | |
"AREACODE":"1207", | |
"DESCRIPTION":"Maine", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"43.3617327", | |
"ALONGITUDE":"-70.4767274" | |
},{ | |
"AREACODE":"1208", | |
"DESCRIPTION":"Idaho", | |
"CLATITUDE":"38.889747", | |
"CLONGITUDE":"-77.025599", | |
"ALATITUDE":"43.4916514", | |
"ALONGITUDE":"-112.0339645" | |
},{ | |
.... | |
} | |
],"return_code":0} |
Please note that CLATITUDE and CLONGITUDE refer to Country Latitude and Country Longitude.